home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / Developer Essentials Jul 90 / DTS Sample Code / Apple II Sample Code / MPW IIGS SC / SC.024.Teach / teach.p / teach.asm < prev    next >
Encoding:
Assembly Source File  |  1990-06-25  |  1.6 KB  |  140 lines  |  [TEXT/MPS ]

  1.     include 'm16.Util2'
  2.     blanks off
  3.  
  4. C1OutputToC1Input    PROC EXPORT
  5.     DefineStack
  6. OrigD    word
  7. TheRTL    block 3
  8. TheHandle    long
  9.  
  10. SizeInputs    equ 4
  11.  
  12.  
  13.     phd
  14.     tsc
  15.     tcd
  16.     phb    ; save dbr
  17.     phk
  18.     plb
  19.  
  20.  
  21.     lda [TheHandle]    ; deref the handle
  22.     tax
  23.     ldy #2
  24.     lda [TheHandle],y
  25.     sta TheHandle+2
  26.     stx TheHandle
  27.  
  28.     lda [TheHandle],y    ; copy the length into the first word
  29.     sta [TheHandle]
  30.     tax    ; and into the x-reg
  31.     sep #$20
  32.     longa off
  33.  
  34.     beq Done    ; if length is zero, we are done
  35.  
  36. More    iny    ; look ahead 2 for next character
  37.     iny
  38.     lda [TheHandle],y
  39.     dey    ; store it where we were
  40.     dey
  41.     sta [TheHandle],y
  42.     iny    ; bump y by one
  43.     dex    ; dec x by one and continue if not zero
  44.     bne More
  45.  
  46.  
  47. Done    rep #$20
  48.     longa on
  49.  
  50.  
  51.     lda TheRTL
  52.     sta TheRTL+SizeInputs
  53.     lda TheRTL+1
  54.     sta TheRTL+1+SizeInputs
  55.     
  56.     plb    ; restore dbr
  57.  
  58.  
  59.     pld
  60.     pla
  61.     pla
  62.     
  63.     rtl
  64.  
  65.     endp
  66.  
  67.  
  68.  
  69. C1OutputToPString    PROC EXPORT
  70.     DefineStack
  71. OrigD    word
  72. TheRTL    block 3
  73. TheHandle    long
  74.  
  75. SizeInputs    equ 4
  76.  
  77.  
  78.     phd
  79.     tsc
  80.     tcd
  81.     phb    ; save dbr
  82.     phk
  83.     plb
  84.  
  85.  
  86.     lda [TheHandle]    ; deref the handle
  87.     tax
  88.     ldy #2
  89.     lda [TheHandle],y
  90.     sta TheHandle+2
  91.     stx TheHandle
  92.  
  93.     lda [TheHandle],y    ; copy the length into the first word
  94.     sta [TheHandle]
  95.     tax    ; and into the x-reg
  96.     sep #$20
  97.     longa off
  98.  
  99.     beq Done    ; if length is zero, we are done
  100.  
  101.     dey    ; start y at 1
  102.  
  103. More    iny    ; look ahead 3 for next character
  104.     iny
  105.     iny
  106.     lda [TheHandle],y
  107.     dey    ; store it where we were
  108.     dey
  109.     dey
  110.     sta [TheHandle],y
  111.     iny    ; bump y by one
  112.     dex    ; dec x by one and continue if not zero
  113.     bne More
  114.  
  115.  
  116. Done    rep #$20
  117.     longa on
  118.  
  119.  
  120.     lda TheRTL
  121.     sta TheRTL+SizeInputs
  122.     lda TheRTL+1
  123.     sta TheRTL+1+SizeInputs
  124.     
  125.     plb    ; restore dbr
  126.  
  127.  
  128.     pld
  129.     pla
  130.     pla
  131.     
  132.     rtl
  133.  
  134.     endp
  135.  
  136.  
  137.  
  138.     END
  139.     
  140.